Finding TXL definitions

[[begin_decl]] is a set of reserved words that signal the beginning of a declaration. In the simplest case, after we encounter a word in [[begin_decl]], we find the identifier and write an index entry. «Finding TXL definitions»= procedure postpass(name, arg) static kind, begin_decl, id_chars, skip_over local what «Set up the static variables» case name of "begin" : arg ? kind := tab(upto(' ')|0) "text" : if kind == "code" then arg ? «Skip a keyword, if needed» if tab(match(!begin_decl)) then tab(many(' ')); writedefn(tab(many(id_chars))) return end

«Skip a keyword, if needed»= tab(many(' ')) what := tab(match(!skip_over)) tab(many(' '))

«Set up the static variables»= initial kind := "bogus" id_chars := &letters ++ &digits ++ '_' begin_decl := ["define", "function", "rule"] skip_over := set(["external"])

«Generic stuff»= procedure prepass(name, arg) if name == "end" then writedefn(&null) # force newline end procedure main(args) go() end

@